[id].vue 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- 导航栏 -->
  5. <HomePageNavigation></HomePageNavigation>
  6. <!-- 面包屑导航 -->
  7. <div class="breadcrumb-box">
  8. <div class="inner">
  9. <span class="location">当前位置:</span>
  10. <el-breadcrumb :separator-icon="ArrowRight">
  11. <el-breadcrumb-item>
  12. <NuxtLink to="/">首页</NuxtLink>
  13. </el-breadcrumb-item>
  14. <el-breadcrumb-item v-if="parent_children_count > 0">
  15. <NuxtLink :to="`/${parent_pinyin}/index.html`"> {{ parent_name }}</NuxtLink>
  16. </el-breadcrumb-item>
  17. <el-breadcrumb-item v-if="parent_children_count == 0">
  18. <NuxtLink :to="`/${parent_pinyin}/list-1.html`"> {{ parent_name }}</NuxtLink>
  19. </el-breadcrumb-item>
  20. <el-breadcrumb-item class="phone_breadcrumb_text">{{ routeNewsTtitle }}</el-breadcrumb-item>
  21. </el-breadcrumb>
  22. </div>
  23. </div>
  24. <!-- 资讯列表 -->
  25. <div class="newsDetail">
  26. <div class="inner">
  27. <div class="innerLeft">
  28. <div class="LeftTop">
  29. <h1>{{ newsDetail.title }}</h1>
  30. <p>
  31. 来源: <span>{{ newsDetail.copyfrom }}</span>
  32. 作者: <span>{{ newsDetail.author }}</span>
  33. 发布时间: <span>{{ time }}</span>
  34. </p>
  35. </div>
  36. <div class="leftBottom" v-html="newsDetail.content" v-if="newsDetail.content" @click="openPreview">
  37. </div>
  38. <div v-if="previewVisible" class="preview-modal" @click="closePreview">
  39. <img :src="selectedImage" alt="Preview">
  40. </div>
  41. <!-- 免责声明: -->
  42. <div class="disclaimer" v-if="newsDetail.copyfrom != '本网'">
  43. <p>原文链接:{{ newsDetail.fromurl }}</p>
  44. <p>[免责声明]本文来源于网络转载,仅供学习交流使用,不构成商业目的。 版权归原作者所有,如涉及作品内容,版权和其他问题,请在30日与本网联系,我们将第一时间处理。</p>
  45. </div>
  46. <div v-if="articleChoice">
  47. <!-- 投票 start ---------------------------------------->
  48. <div class="index_3_box_vote" v-if="articleChoice">
  49. <div class="voteTitle">投票区</div>
  50. <div class="inquire">
  51. <p v-if="voteList.length > 0">{{ voteList[0].survey_name }}</p>
  52. <div class="radioBox">
  53. <!--投票选项-->
  54. <div v-if="!isDisabled">
  55. <div class="radio" v-if="isRadio">
  56. <el-radio-group v-model="radio1" @change="handleRadioChange">
  57. <el-radio v-for="item in voteList" :key="item.id" :value="item.id"
  58. size="large">
  59. <span v-if="item.is_other == 0">{{ item.choice_name }}</span>
  60. <span v-else>其他</span>
  61. </el-radio>
  62. </el-radio-group>
  63. <el-input v-if="showUserChoice" v-model="userChoice" :rows="2" type="textarea"
  64. resize="none" placeholder="请输入.." />
  65. </div>
  66. <div class="checkInputBox" v-else>
  67. <el-checkbox-group v-model="check1" @change="handleCheckboxChange">
  68. <span v-for="item in voteList" :key="item.id">
  69. <span v-if="item.is_other == 0">
  70. <el-checkbox size="large" :label="item.choice_name"
  71. :value="item.id" />
  72. </span>
  73. <span v-else>
  74. <el-checkbox size="large" label="其他" :value="item.id" />
  75. </span>
  76. </span>
  77. </el-checkbox-group>
  78. <el-input v-if="showUserChoice" v-model="userChoice" :rows="2" type="textarea"
  79. resize="none" placeholder="请输入.." />
  80. </div>
  81. </div>
  82. <!--投票结果-->
  83. <div class="inquireData" v-else>
  84. <div v-for="item in websiteSurveyData.data" :key="item.id">
  85. <div class="inquireDataItem active" v-if="item.status == 1">
  86. <div class="inquireDataItemTitle">
  87. <span v-if="item.choice_name == ''">其他</span>
  88. <span v-else>{{ item.choice_name }}</span>
  89. </div>
  90. <div class="inquireDataItemNum">{{ item.results }}票</div>
  91. </div>
  92. <div class="inquireDataItem" v-else>
  93. <div class="inquireDataItemTitle">
  94. <span v-if="item.choice_name == ''">其他</span>
  95. <span v-else>{{ item.choice_name }}</span>
  96. </div>
  97. <div class="inquireDataItemNum">{{ item.results }}票</div>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. <div class="btn">
  103. <button class="voting" @click="addWebsiteSurvey" :disabled="isDisabled"
  104. v-if="!isDisabled">投票</button>
  105. </div>
  106. </div>
  107. </div>
  108. <!-- 投票 end ---------------------------------------->
  109. </div>
  110. <div class="recommendRead" v-if="newsDetail.commendArticle != false">
  111. <div class="recommendReadTitle">
  112. <span class="read_title">
  113. 推荐阅读
  114. </span>
  115. </div>
  116. <div class="recommendReadList">
  117. <div class="recommendReadListTitle" v-for="(item, index) in newsDetail.commendArticle"
  118. :key="item.id">
  119. <a :href="`/${item.alias_pinyin}/${item.id}.html`" v-if="index < 3">
  120. {{ item.title }}
  121. </a>
  122. </div>
  123. </div>
  124. </div>
  125. <!--上一篇 下一篇-->
  126. <div class="prevNext">
  127. <NuxtLink to="/">上一篇:李强签署国务院令 公布《行政执法监督条例》</NuxtLink>
  128. <NuxtLink to="/">下一篇:没有了</NuxtLink>
  129. </div>
  130. </div>
  131. <div class="innerRight">
  132. <!-- 热点资讯1 -->
  133. <!-- <div class="hotList1">
  134. <DetailHotNews></DetailHotNews>
  135. </div> -->
  136. <!-- 热点资讯2 -->
  137. <div class="hotList2">
  138. <DetailHotNews2></DetailHotNews2>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. <!-- 页面底部 -->
  144. <HomeFoot></HomeFoot>
  145. </template>
  146. <script setup>
  147. //1.页面依赖 start ---------------------------------------->
  148. import { onMounted } from 'vue'
  149. import { ElBreadcrumb, ElBreadcrumbItem, ElRadio, ElRadioGroup, ElCheckbox, ElCheckboxGroup, ElMessage, ElInput } from 'element-plus'
  150. import { ArrowRight } from '@element-plus/icons-vue'
  151. const nuxtApp = useNuxtApp();
  152. const axios = nuxtApp.$axios;
  153. //1.1 获得跳转过来的id
  154. const route = useRoute();
  155. //获得详情id
  156. const articleId = parseInt(route.params.id); //获得该页面的id
  157. //获得当前的完整路径
  158. const fullPath = route.path;
  159. //拆分,取出来中间这一段,然后提取数字部分
  160. const segments = fullPath.split('/');
  161. const targetSegment = segments[1];
  162. // const numberPart = targetSegment.match(/\d+$/)?.[0];
  163. // let routeId = 20 //排除路径错误可以打开这个
  164. // const routeId = numberPart;
  165. let routeId;
  166. //通过导航路径反向查询导航id
  167. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  168. method: 'GET',
  169. query: {
  170. 'pinyin': targetSegment,
  171. },
  172. });
  173. if (getRouteId.code == 200) {
  174. routeId = getRouteId.data.category_id
  175. } else {
  176. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  177. console.log("错误位置:通过url路径查询导航池id")
  178. console.log("后端错误反馈:", getRouteId.message)
  179. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  180. }
  181. //1.2 获得父级栏目的名称、id
  182. const parent_name = ref([]);
  183. const parent_id = ref([]);
  184. const parent_pinyin = ref("");
  185. const parent_children_count = ref(0)
  186. let getParentNav = async () => {
  187. const listData = await requestDataPromise('/web/getOneWebsiteCategory', {
  188. method: 'GET',
  189. query: {
  190. 'catid': routeId
  191. },
  192. });
  193. console.log("获取父级栏目数据")
  194. console.log(listData)
  195. if (listData.code == 200) {
  196. console.log(listData.data);
  197. parent_name.value = listData.data.alias;
  198. parent_id.value = listData.data.parent_id;
  199. parent_pinyin.value = listData.data.aLIas_pinyin;
  200. parent_children_count.value = listData.data.children_count;
  201. } else {
  202. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  203. console.log("错误位置:获取面包屑导航")
  204. console.log("后端错误反馈:", listData.message)
  205. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  206. }
  207. }
  208. //获得父级栏目详情
  209. getParentNav();
  210. //1.页面依赖 end ---------------------------------------->
  211. //2.页面数据 start ---------------------------------------->
  212. //2.1 资讯详情
  213. const newsDetail = ref({})
  214. const routeNewsTtitle = ref("");
  215. //2.2 发布日期
  216. const time = ref("");
  217. //2.3 路径
  218. const routLevelTitle = ref("");
  219. const routLevelId = ref("");
  220. //是否展示投票
  221. const articleChoice = ref(false);
  222. //2.4获取详情
  223. async function getPageData() {
  224. const mkdata = await requestDataPromise('/web/selectWebsiteArticleInfo', {
  225. method: 'GET',
  226. query: {
  227. 'articleid': articleId
  228. },
  229. });
  230. if (mkdata.code == 200) {
  231. //判断是否显示投票
  232. if (mkdata.data.is_survey == 1) {
  233. console.log("本篇文章含有投票!")
  234. articleChoice.value = true;
  235. getVoteList();
  236. }
  237. //获取内容
  238. newsDetail.value = mkdata.data;
  239. //获取路径
  240. routLevelTitle.value = newsDetail.value.cat_name;
  241. routLevelId.value = newsDetail.value.category_id;
  242. //获取发布时间
  243. time.value = newsDetail.value.updated_at.split(' ')[0];
  244. //修正标题长度
  245. if (newsDetail.value.title.length >= 30) {
  246. routeNewsTtitle.value = newsDetail.value.title.substr(0, 30) + "...";
  247. } else {
  248. routeNewsTtitle.value = newsDetail.value.title
  249. }
  250. } else {
  251. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  252. console.log("错误位置:获取详情内容")
  253. console.log("后端错误反馈:", mkdata.message)
  254. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  255. }
  256. }
  257. getPageData();
  258. //2.5 获得广告
  259. //广告列表
  260. let adImg1 = ref([]);
  261. // async function getAdData(){
  262. // const adData = await requestDataPromise('/web/getWebsiteAdvertisement',{method:'GET',query:{'ad_tag':'DETAIL'}});
  263. // if(adData.code==200){
  264. // for(let item of adData.data){
  265. // if(item.ad_tag == 'DETAIL_0001'){
  266. // adImg1.value = item;
  267. // }
  268. // }
  269. // }else{
  270. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  271. // console.log("错误位置:获取详情页广告列表")
  272. // console.log("后端错误反馈:",adData.message)
  273. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  274. // }
  275. // }
  276. // getAdData();
  277. onMounted(async () => {
  278. const { $webUrl, $CwebUrl } = useNuxtApp();
  279. //广告1
  280. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_detail_0001`
  281. const responseAd1 = await fetch(url, {
  282. headers: {
  283. 'Content-Type': 'application/json',
  284. 'Userurl': $CwebUrl,
  285. 'Origin': $CwebUrl
  286. }
  287. });
  288. const resultAd1 = await responseAd1.json();
  289. adImg1.value = resultAd1.data[0];
  290. })
  291. //2.页面数据 end ---------------------------------------->
  292. //3.设置seo信息 start---------------------------------------->
  293. //3.1 设置seo信息
  294. const setData = await requestDataPromise('/web/selectWebsiteArticleInfo', {
  295. method: 'GET',
  296. query: {
  297. 'articleid': articleId
  298. },
  299. });
  300. if (setData.code == 200) {
  301. let seoTitle = setData.data.title;
  302. let seoDescription = setData.data.introduce;
  303. let seoKeywords = setData.data.keyword;
  304. let seoSuffix = setData.data.suffix;
  305. let seoName = setData.data.website_name;
  306. useSeoMeta({
  307. title: seoTitle + "_" + seoName + "_" + seoSuffix,
  308. meta: [
  309. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  310. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  311. { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no', tagPriority: 10 }
  312. ]
  313. });
  314. } else {
  315. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  316. console.log("错误位置:设置详情页面SEO数据")
  317. console.log("后端错误反馈:", setData.message)
  318. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  319. }
  320. //3.设置seo信息 end---------------------------------------->
  321. //4.投票 start---------------------------------------->
  322. const radio1 = ref(''); //单选
  323. const check1 = ref([]); //多选
  324. const isDisabled = ref(false);//是否禁用提交按钮
  325. const isRadio = ref(true);//是否渲染单选
  326. const userSurId = ref('');//投票属于哪一篇文章
  327. const userChoice = ref('');//用于判断用户选择了其他选项以后,输入的值
  328. const userIsChoice = ref('');//用于判断其他选项目前是什么值
  329. const showUserChoice = ref(false);//是否显示其他输入框
  330. const websiteSurveyData = ref([]);//投票结果
  331. //3.2获得投票列表
  332. let voteList = ref([]);
  333. async function getVoteList() {
  334. const voteData = await requestHome('/web/getWebsiteSurvey', { method: 'GET', query: { 'art_id': articleId } });
  335. console.log(778899)
  336. console.log(voteData)
  337. if (voteData.code == 200) {
  338. voteList.value = voteData.data;
  339. console.log(voteList.value)
  340. //判断显示单选还是多选
  341. //survey_type 0是单选 1是多选
  342. if (voteData.data[0].survey_type == 0) {
  343. isRadio.value = true;
  344. console.log("1111")
  345. } else {
  346. isRadio.value = false;
  347. }
  348. //把最后一个的值拿出来 用于判断用户是否选择了其他
  349. for (let item of voteData.data) {
  350. //如果含有其他
  351. if (item.is_other == 1) {
  352. userIsChoice.value = item.id;
  353. }
  354. }
  355. //用户投票属于哪一篇文章
  356. userSurId.value = voteData.data[0].sur_id;
  357. } else {
  358. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  359. console.log("错误位置:首页投票")
  360. console.log("后端错误反馈:", voteData.message)
  361. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  362. }
  363. }
  364. //3.2当用户选择了选项,判断是否展示其他输入框
  365. const handleRadioChange = (value) => {
  366. if (value == userIsChoice.value) {
  367. showUserChoice.value = true;
  368. } else {
  369. showUserChoice.value = false;
  370. }
  371. }
  372. const handleCheckboxChange = (value) => {
  373. if (value.includes(userIsChoice.value)) {
  374. showUserChoice.value = true;
  375. } else {
  376. showUserChoice.value = false;
  377. }
  378. }
  379. //3.2发起投票
  380. async function addWebsiteSurvey() {
  381. //判断当前是单选还是多选
  382. console.log(isRadio.value)
  383. if (isRadio.value) {
  384. console.log("用户单选!")
  385. if (radio1.value != '') {
  386. //先判断一下是否使用了其他选项
  387. if (showUserChoice.value) {
  388. if (userChoice.value != '') {
  389. //文章id
  390. // console.log(userSurId.value)
  391. // 用户输入的值
  392. // console.log(userChoice.value)
  393. //如果使用了其他,其他的选项需要增加进去
  394. const ChoiceData = await requestHome('/web/addWebsiteSurveyOption', {
  395. method: 'GET',
  396. query: {
  397. 'sur_id': userSurId.value,//投票的新闻id
  398. 'choice_name': userChoice.value,//投票的选项id
  399. }
  400. });
  401. if (ChoiceData.code == 200) {
  402. //提交完其他选项以后,再正式发起投票
  403. const mkData = await requestHome('/web/addWebsiteSurveyVote', {
  404. method: 'GET',
  405. query: {
  406. 'sur_id': userSurId.value,
  407. 'choice_id': ChoiceData.data
  408. }
  409. });
  410. if (mkData.code == 200) {
  411. ElMessage.success('投票成功!')
  412. //把投票结果显示到页面上 禁用投票按钮
  413. isDisabled.value = true;
  414. websiteSurveyData.value = mkData.data;
  415. //遍历一下,把用户选中的那个设置status为1
  416. let data = mkData.data;
  417. //遍历一下,把用户选中的那个设置status为1
  418. for (let item of data.data) {
  419. for (let i of data.choice) {
  420. if (item.id == i) {
  421. console.log(item.id)
  422. item.status = 1;
  423. }
  424. }
  425. }
  426. websiteSurveyData.value = data;
  427. } else {
  428. ElMessage.error(mkData.message)
  429. }
  430. } else {
  431. ElMessage.error('其他投票失败!')
  432. }
  433. } else {
  434. ElMessage.error('请输入选项内容!')
  435. }
  436. } else {
  437. //如果没选择其他,直接提交选择的内容
  438. const mkData = await requestHome('/web/addWebsiteSurveyVote', {
  439. method: 'GET',
  440. query: {
  441. 'sur_id': userSurId.value,
  442. 'choice_id': radio1.value
  443. }
  444. });
  445. if (mkData.code == 200) {
  446. ElMessage.success('投票成功!')
  447. //把投票结果显示到页面上 禁用投票按钮
  448. isDisabled.value = true;
  449. let data = mkData.data;
  450. //遍历一下,把用户选中的那个设置status为1
  451. for (let item of data.data) {
  452. for (let i of data.choice) {
  453. if (item.id == i) {
  454. item.status = 1;
  455. }
  456. }
  457. }
  458. websiteSurveyData.value = data;
  459. } else {
  460. ElMessage.error('投票失败!')
  461. }
  462. }
  463. } else {
  464. ElMessage.error('请选择一个选项')
  465. }
  466. } else {
  467. console.log("多选!")
  468. //多选
  469. if (check1.value != []) {
  470. //先判断一下是否使用了其他选项
  471. if (showUserChoice.value) {
  472. if (userChoice.value != '') {
  473. //判断用户是否只选择了一个其他
  474. if (check1.value.length == 1) {
  475. const ChoiceData = await requestDataPromise('/web/addWebsiteSurveyOption', {
  476. method: 'GET',
  477. query: {
  478. 'sur_id': userSurId.value,//投票的新闻id
  479. 'choice_name': userChoice.value,//用户输入的其他选项文字
  480. }
  481. });
  482. if (ChoiceData.code == 200) {
  483. //提交完其他选项以后,再正式发起投票
  484. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote', {
  485. method: 'GET',
  486. query: {
  487. 'sur_id': userSurId.value,
  488. 'choice_id': ChoiceData.data
  489. }
  490. });
  491. if (mkData.code == 200) {
  492. ElMessage.success('投票成功!')
  493. //把投票结果显示到页面上 禁用投票按钮
  494. isDisabled.value = true;
  495. websiteSurveyData.value = mkData.data;
  496. //遍历一下,把用户选中的那个设置status为1
  497. let data = mkData.data;
  498. //遍历一下,把用户选中的那个设置status为1
  499. for (let item of data.data) {
  500. for (let i of data.choice) {
  501. if (item.id == i) {
  502. console.log(item.id)
  503. item.status = 1;
  504. }
  505. }
  506. }
  507. websiteSurveyData.value = data;
  508. } else {
  509. ElMessage.error(mkData.message)
  510. }
  511. } else {
  512. ElMessage.error('其他投票失败!')
  513. }
  514. } else {
  515. //用户选择了除了其他以外,还包括别的选项
  516. const ChoiceData = await requestDataPromise('/web/addWebsiteSurveyOption', {
  517. method: 'GET',
  518. query: {
  519. 'sur_id': userSurId.value,//投票的新闻id
  520. 'choice_name': userChoice.value,//用户输入的其他选项文字
  521. }
  522. });
  523. if (ChoiceData.code == 200) {
  524. let data = check1.value;
  525. //找到多选的数组,把其他默认值给替换掉
  526. for (let i = 0; i < data.length; i++) {
  527. if (data[i] == userIsChoice.value) {
  528. data[i] = ChoiceData.data;
  529. }
  530. }
  531. let jsonArray = JSON.stringify(data);
  532. //提交完其他选项以后,再正式发起投票
  533. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote', {
  534. method: 'GET',
  535. query: {
  536. 'sur_id': userSurId.value,
  537. 'choice_id': jsonArray
  538. }
  539. });
  540. if (mkData.code == 200) {
  541. ElMessage.success('投票成功!')
  542. //把投票结果显示到页面上 禁用投票按钮
  543. isDisabled.value = true;
  544. websiteSurveyData.value = mkData.data;
  545. //遍历一下,把用户选中的那个设置status为1
  546. let data = mkData.data;
  547. //遍历一下,把用户选中的那个设置status为1
  548. for (let item of data.data) {
  549. for (let i of data.choice) {
  550. if (item.id == i) {
  551. //console.log(item.id)
  552. item.status = 1;
  553. }
  554. }
  555. }
  556. websiteSurveyData.value = data;
  557. } else {
  558. ElMessage.error(mkData.message)
  559. }
  560. } else {
  561. ElMessage.error('其他投票失败!')
  562. }
  563. }
  564. } else {
  565. ElMessage.error('请输入选项内容!')
  566. }
  567. } else {
  568. let jsonArray = JSON.stringify(check1.value);
  569. //如果没选择其他,直接提交选择的内容
  570. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote', {
  571. method: 'GET',
  572. query: {
  573. 'sur_id': userSurId.value,
  574. 'choice_id': jsonArray
  575. }
  576. });
  577. if (mkData.code == 200) {
  578. ElMessage.success('投票成功!')
  579. //把投票结果显示到页面上 禁用投票按钮
  580. isDisabled.value = true;
  581. websiteSurveyData.value = mkData.data;
  582. //遍历一下,把用户选中的那个设置status为1
  583. let data = mkData.data;
  584. //遍历一下,把用户选中的那个设置status为1
  585. for (let item of data.data) {
  586. for (let i of data.choice) {
  587. if (item.id == i) {
  588. console.log(item.id)
  589. item.status = 1;
  590. }
  591. }
  592. }
  593. websiteSurveyData.value = data;
  594. } else {
  595. ElMessage.error('投票失败!')
  596. }
  597. }
  598. } else {
  599. ElMessage.error('请选择一个选项')
  600. }
  601. }
  602. }
  603. //4.投票 end---------------------------------------->
  604. //5.页面图片放大 start---------------------------------------->
  605. const previewVisible = ref(false)
  606. const selectedImage = ref(' ')
  607. const openPreview = (event) => {
  608. if (event.target.tagName === 'IMG') {
  609. selectedImage.value = event.target.src;
  610. previewVisible.value = true;
  611. }
  612. }
  613. const closePreview = () => {
  614. previewVisible.value = false;
  615. }
  616. //5.页面图片放大 end---------------------------------------->
  617. </script>
  618. <style lang="less" scoped>
  619. //@import url('@/assets/css/article/pc.less');
  620. //@import url('@/assets/css/article/yd.less');
  621. //面包屑
  622. .breadcrumb-box {
  623. width: 1400PX;
  624. margin: 0 auto;
  625. .inner {
  626. width: 100%;
  627. height: 22PX;
  628. margin-top: 20PX;
  629. margin-bottom: 20PX;
  630. font-family: Microsoft YaHei, Microsoft YaHei;
  631. font-weight: 400;
  632. font-size: 20PX;
  633. color: #666666;
  634. line-height: 23PX;
  635. text-align: left;
  636. font-style: normal;
  637. text-transform: none;
  638. display: flex;
  639. align-items: center;
  640. border-bottom: 1PX dashed #ccc;
  641. margin-bottom: 10PX;
  642. padding: 20PX 20PX 20PX 0;
  643. box-sizing: border-box;
  644. a {
  645. font-size: 16PX;
  646. color: #000;
  647. line-height: 20PX;
  648. }
  649. span {
  650. font-size: 16PX;
  651. color: #000;
  652. line-height: 20PX;
  653. &.location {
  654. line-height: 20PX;
  655. }
  656. }
  657. }
  658. }
  659. //资讯详情
  660. .newsDetail {
  661. width: 100%;
  662. margin-bottom: 10PX;
  663. .inner {
  664. width: 1400PX;
  665. overflow: hidden;
  666. font-size: 16PX;
  667. display: flex;
  668. align-items: flex-start;
  669. justify-content: space-between;
  670. .innerLeft {
  671. width: 1030PX;
  672. .LeftTop {
  673. margin-top: 20PX;
  674. border-bottom: 1PX dashed #ccc;
  675. padding-bottom: 20PX;
  676. >h1 {
  677. line-height: 40PX;
  678. margin-bottom: 20PX;
  679. font-family: Microsoft YaHei, Microsoft YaHei;
  680. font-weight: bold;
  681. font-size: 24PX;
  682. color: #333333;
  683. text-align: center;
  684. }
  685. >p {
  686. height: 18PX;
  687. line-height: 18PX;
  688. font-family: Microsoft YaHei, Microsoft YaHei;
  689. font-weight: 400;
  690. font-size: 14PX;
  691. color: #999999;
  692. text-align: center;
  693. span {
  694. margin-right: 40PX;
  695. }
  696. }
  697. >img {
  698. width: 680PX;
  699. height: 382PX;
  700. padding: 50PX 0PX 60PX 55PX;
  701. }
  702. }
  703. .leftBottom {
  704. margin-top: 20PX;
  705. font-size: 20PX;
  706. line-height: 38PX;
  707. margin-bottom: 30PX;
  708. word-break: break-all;
  709. ul>li img {
  710. width: 790PX;
  711. height: 382PX;
  712. }
  713. img {
  714. width: 790PX;
  715. height: 382PX;
  716. }
  717. p.tinymce-material {
  718. img {
  719. width: 790PX;
  720. }
  721. }
  722. >h3,
  723. >p {
  724. text-indent: 2em;
  725. width: 790PX;
  726. font-family: Microsoft YaHei, Microsoft YaHei;
  727. font-size: 20PX;
  728. color: #333333;
  729. line-height: 38PX;
  730. padding-bottom: 30PX;
  731. img {
  732. width: 790PX;
  733. }
  734. }
  735. >h3 {
  736. font-weight: 600PX;
  737. }
  738. >p {
  739. font-weight: 400;
  740. }
  741. }
  742. .disclaimer {
  743. width: 790PX;
  744. overflow: hidden;
  745. border-top: 1PX solid #e6e6e6;
  746. padding: 30PX 0PX;
  747. color: #999999;
  748. font-size: 17PX;
  749. p {
  750. width: 790PX;
  751. line-height: 30PX;
  752. }
  753. }
  754. .recommendRead {
  755. width: 100%;
  756. margin: 30PX 0PX 20PX 0;
  757. .recommendReadTitle {
  758. font-size: 18PX;
  759. color: #001996;
  760. height: 42PX;
  761. line-height: 35PX;
  762. letter-spacing: 1PX;
  763. text-align: left;
  764. font-style: normal;
  765. text-transform: none;
  766. border-bottom: 1PX solid #D9D9D9;
  767. .read_title {
  768. display: inline-block;
  769. text-align: center;
  770. width: 94PX;
  771. height: 40PX;
  772. border-bottom: 2PX solid #158d91;
  773. }
  774. }
  775. .recommendReadList {
  776. min-height: 155PX;
  777. margin-top: 20PX;
  778. padding-bottom: 10PX;
  779. font-size: 16PX;
  780. border-bottom: 1PX solid #D9D9D9;
  781. .recommendReadListTitle {
  782. margin-top: 18PX;
  783. a {
  784. &:hover {
  785. color: #158d91;
  786. }
  787. color: #333333;
  788. }
  789. }
  790. .recommendReadListTitle:nth-child(1)::after {
  791. content: "热";
  792. margin-left: 13PX;
  793. background: #FF8A37;
  794. color: #fff;
  795. font-size: 14PX;
  796. padding: 0PX 2PX;
  797. }
  798. .recommendReadListTitle:hover a {
  799. color: #158d91;
  800. }
  801. }
  802. }
  803. }
  804. .innerRight {
  805. width: 315PX;
  806. overflow: hidden;
  807. .hotList1 {
  808. margin-bottom: 50PX;
  809. }
  810. }
  811. }
  812. }
  813. .leftBottom::v-deep p img,
  814. .leftBottom::v-deep img,
  815. .leftBottom::v-deep video {
  816. max-width: 700px;
  817. }
  818. .leftBottom::v-deep h1,
  819. .leftBottom::v-deep h2,
  820. .leftBottom::v-deep h3,
  821. .leftBottom::v-deep h4,
  822. .leftBottom::v-deep h5,
  823. .leftBottom::v-deep h6 {
  824. font-size: 20px;
  825. font-weight: 500;
  826. }
  827. //投票
  828. .index_3_box_vote {
  829. .voteTitle {
  830. font-size: 20px;
  831. height: 40px;
  832. line-height: 40px;
  833. color: #333333;
  834. padding-left: 20px;
  835. width: 100%;
  836. border-bottom: 1px solid #E7E7E7;
  837. border-top: 1px solid #139602;
  838. box-sizing: border-box;
  839. }
  840. width:100%;
  841. box-sizing:border-box;
  842. border:solid 1px #FBFBFB;
  843. background: #FBFBFB;
  844. .inquire {
  845. height: 394px;
  846. margin-top: 20px;
  847. border-radius: 6px 6px 6px 6px;
  848. padding: 4px 40px 4px 6px;
  849. box-sizing: border-box;
  850. p {
  851. font-weight: bold;
  852. height: 69px;
  853. font-family: PingFang SC, PingFang SC;
  854. font-size: 20px;
  855. color: #333333;
  856. line-height: 21px;
  857. text-align: left;
  858. font-style: normal;
  859. text-transform: none;
  860. padding: 12px 20px 0 32px;
  861. }
  862. .radioBox {
  863. height: 250px;
  864. padding-left: 30px;
  865. overflow-y: auto;
  866. box-sizing: border-box;
  867. padding-bottom: 20px;
  868. }
  869. .radio {
  870. /deep/.el-radio {
  871. --el-radio-input-border-color-hover: #27881a;
  872. }
  873. /deep/.el-radio-group {
  874. align-items: center;
  875. display: inline-flex;
  876. flex-wrap: wrap;
  877. font-size: 0;
  878. //padding-left: 35px;
  879. }
  880. /deep/.el-radio.el-radio--large {
  881. width: 100%;
  882. height: 29px;
  883. margin-bottom: 15px;
  884. }
  885. /deep/.el-radio.el-radio--large .el-radio__label {
  886. font-family: PingFang SC, PingFang SC;
  887. font-weight: 400;
  888. font-size: 16px;
  889. color: #333333;
  890. white-space: nowrap;
  891. overflow: hidden;
  892. text-overflow: ellipsis;
  893. width: 300px;
  894. }
  895. /deep/.el-radio.el-radio--large .el-radio__inner {
  896. height: 16px;
  897. width: 16px;
  898. }
  899. /deep/.el-radio__input.is-checked+.el-radio__label {
  900. color: #27881a;
  901. }
  902. /deep/.el-radio__input.is-checked .el-radio__inner {
  903. background: #33b023;
  904. border-color: #27881a;
  905. }
  906. }
  907. .checkInputBox {
  908. /deep/.el-checkbox {
  909. --el-radio-input-border-color-hover: #27881a;
  910. }
  911. /deep/.el-checkbox-group {
  912. align-items: center;
  913. display: inline-flex;
  914. flex-wrap: wrap;
  915. font-size: 0;
  916. //padding-left: 35px;
  917. }
  918. /deep/.el-checkbox.el-checkbox--large {
  919. width: 330px;
  920. height: 29px;
  921. margin-bottom: 15px;
  922. }
  923. /deep/.el-checkbox.el-checkbox--large .el-checkbox__label {
  924. font-family: PingFang SC, PingFang SC;
  925. font-weight: 400;
  926. font-size: 16px;
  927. color: #333333;
  928. white-space: nowrap;
  929. overflow: hidden;
  930. text-overflow: ellipsis;
  931. width: 300px;
  932. }
  933. /deep/.el-checkbox.el-checkbox--large .el-checkbox__inner {
  934. height: 16px;
  935. width: 16px;
  936. }
  937. /deep/.el-checkbox__input.is-checked+.el-checkbox__label {
  938. color: #27881a;
  939. }
  940. /deep/.el-checkbox__input.is-checked .el-checkbox__inner {
  941. background: #33b023;
  942. border-color: #27881a;
  943. }
  944. }
  945. .btn {
  946. padding-left: 30px;
  947. button {
  948. width: 78px;
  949. height: 37px;
  950. line-height: 37px;
  951. border-radius: 6px;
  952. border: none;
  953. font-family: PingFang SC, PingFang SC;
  954. font-weight: 400;
  955. font-size: 16px;
  956. color: #999999;
  957. }
  958. .voting {
  959. background-color: #49A769;
  960. color: #fff;
  961. margin-right: 44px;
  962. cursor: pointer;
  963. }
  964. .look {
  965. cursor: pointer;
  966. }
  967. }
  968. }
  969. .inquireData {
  970. .inquireDataItem {
  971. width: 100%;
  972. height: 38px;
  973. display: flex;
  974. align-items: center;
  975. justify-content: space-between;
  976. background: #F3F3F3;
  977. border: 1px solid #D2D2D2;
  978. margin-bottom: 10px;
  979. border-radius: 6px;
  980. padding: 0 15px;
  981. box-sizing: border-box;
  982. color: #999999;
  983. .inquireDataItemTitle {
  984. width: 290px;
  985. height: 38px;
  986. font-size: 16px;
  987. line-height: 38px;
  988. white-space: nowrap;
  989. overflow: hidden;
  990. text-overflow: ellipsis;
  991. }
  992. .inquireDataItemNum {
  993. font-size: 16px;
  994. }
  995. }
  996. .active {
  997. color: #49A769;
  998. background: #dff7e8;
  999. border: 1px solid #49A769;
  1000. }
  1001. }
  1002. }
  1003. //放大图片
  1004. .preview-modal {
  1005. position: fixed;
  1006. top: 0;
  1007. left: 0;
  1008. width: 100%;
  1009. height: 100%;
  1010. background: rgba(0, 0, 0, 0.8);
  1011. display: flex;
  1012. justify-content: center;
  1013. align-items: center;
  1014. z-index: 1000;
  1015. }
  1016. .preview-modal img {
  1017. max-width: 100%;
  1018. max-height: 100%;
  1019. cursor: pointer;
  1020. }
  1021. //上一篇 下一篇
  1022. .prevNext {
  1023. border-bottom: 1px solid #ccc;
  1024. padding-bottom: 10px;
  1025. a {
  1026. display: block;
  1027. color: #333;
  1028. font-size: 15px;
  1029. display: block;
  1030. height: 40px;
  1031. line-height: 40px;
  1032. &:hover {
  1033. color: #0071B7;
  1034. }
  1035. }
  1036. }
  1037. .breadcrumb-box {
  1038. width: 1400PX;
  1039. margin: 0px auto 0px;
  1040. }
  1041. .el-breadcrumb {
  1042. height: 22PX;
  1043. line-height: 22PX;
  1044. }
  1045. .breadcrumb-box .inner span.location {
  1046. font-size: 16PX;
  1047. ;
  1048. height: 22PX;
  1049. ;
  1050. line-height: 22PX;
  1051. font-weight: normal;
  1052. word-break: keep-all;
  1053. white-space: nowrap;
  1054. }
  1055. .breadcrumb-box .inner a {
  1056. font-size: 16PX;
  1057. ;
  1058. height: 22PX;
  1059. line-height: 22PX;
  1060. display: inline-block;
  1061. font-weight: normal;
  1062. }
  1063. .breadcrumb-box .phone_breadcrumb_text /deep/.el-breadcrumb__inner {
  1064. font-size: 16PX;
  1065. ;
  1066. height: 22PX;
  1067. line-height: 22PX;
  1068. font-weight: normal;
  1069. }
  1070. .breadcrumb-box:deep(.el-icon) {
  1071. width: 16PX;
  1072. height: 16PX;
  1073. }
  1074. .breadcrumb-box .inner span {
  1075. font-size: 16PX;
  1076. height: 22PX;
  1077. line-height: 22PX;
  1078. }
  1079. .el-breadcrumb__inner {}
  1080. .newsDetail {
  1081. box-sizing: border-box;
  1082. overflow: hidden;
  1083. width: 1400PX;
  1084. margin: 0px auto 0px;
  1085. }
  1086. .newsDetail .inner {
  1087. display: block;
  1088. overflow: hidden;
  1089. width: 100%;
  1090. }
  1091. .newsDetail .inner .innerLeft .LeftTop>h1 {
  1092. font-size: 24PX;
  1093. line-height: 33PX;
  1094. }
  1095. .newsDetail .inner .innerLeft .LeftTop>p span {
  1096. font-size: 14PX;
  1097. }
  1098. .newsDetail .inner .innerLeft .leftBottom {
  1099. font-size: 18PX;
  1100. line-height: 22px;
  1101. }
  1102. .newsDetail .inner .innerLeft .recommendRead .recommendReadTitle {
  1103. height: 33PX;
  1104. line-height: 33PX;
  1105. }
  1106. .newsDetail .inner .innerLeft .recommendRead .recommendReadTitle .read_title {
  1107. height: 33PX;
  1108. line-height: 33PX;
  1109. font-size: 16PX;
  1110. width: auto;
  1111. box-sizing: border-box;
  1112. float: left;
  1113. }
  1114. .newsDetail .inner .innerLeft {
  1115. float: left;
  1116. width: 64%;
  1117. overflow: hidden;
  1118. margin-right: 0px;
  1119. }
  1120. .newsDetail .inner .innerRight {
  1121. float: right;
  1122. width: 33%;
  1123. overflow: hidden;
  1124. }
  1125. .innerRight .hotList2 {
  1126. width: 100%;
  1127. }
  1128. .newsDetail .inner .innerLeft .LeftTop>p {
  1129. font-size: 14PX;
  1130. }
  1131. .newsDetail .inner .innerLeft .recommendRead .recommendReadList {}
  1132. .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle {
  1133. line-height: 33PX;
  1134. height: 33PX;
  1135. }
  1136. .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle a {
  1137. line-height: 33PX;
  1138. height: 33PX;
  1139. padding-right: 22PX;
  1140. box-sizing: border-box;
  1141. font-size: 16PX;
  1142. width: 90%;
  1143. float: left;
  1144. display: block;
  1145. word-break: keep-all;
  1146. white-space: nowrap;
  1147. overflow: hidden;
  1148. text-overflow: ellipsis;
  1149. }
  1150. .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle:nth-child(1)::after {
  1151. font-size: 14PX;
  1152. margin-top: 1PX;
  1153. }
  1154. .prevNext a {
  1155. height: 40PX;
  1156. line-height: 40PX;
  1157. font-size: 15PX;
  1158. width: 100%;
  1159. display: block;
  1160. word-break: keep-all;
  1161. white-space: nowrap;
  1162. overflow: hidden;
  1163. text-overflow: ellipsis;
  1164. }
  1165. @media screen and (min-width: 1401px) {}
  1166. @media screen and (max-width: 1400px) {
  1167. .breadcrumb-box {
  1168. width: 100%;
  1169. margin: 0px auto 0px;
  1170. box-sizing: border-box;
  1171. padding: 0px 10px;
  1172. }
  1173. .newsDetail {
  1174. width: 100%;
  1175. margin: 0px auto 0px;
  1176. box-sizing: border-box;
  1177. padding: 0px 10px;
  1178. overflow: hidden;
  1179. }
  1180. }
  1181. @media screen and (min-width: 801px) and (max-width: 1400px) {
  1182. //你的样式
  1183. }
  1184. @media screen and (max-width: 800px) {
  1185. //你的样式
  1186. .newsDetail .inner {
  1187. display: block;
  1188. width: 100%;
  1189. }
  1190. .newsDetail .inner .innerLeft {
  1191. width: 100%;
  1192. }
  1193. .newsDetail .inner .innerRight {
  1194. width: 100%;
  1195. }
  1196. .breadcrumb-box .phone_breadcrumb_text /deep/.el-breadcrumb__inner {
  1197. width: 100PX;
  1198. display: block;
  1199. word-break: keep-all;
  1200. white-space: nowrap;
  1201. overflow: hidden;
  1202. text-overflow: ellipsis;
  1203. }
  1204. .newsDetail .inner .innerLeft .recommendRead .recommendReadTitle .read_title {
  1205. width: auto;
  1206. }
  1207. .newsDetail .inner .innerLeft .leftBottom {
  1208. line-height: 33PX;
  1209. }
  1210. .breadcrumb-box :deep(.el-icon) {}
  1211. .breadcrumb-box .inner span.location,
  1212. .breadcrumb-box .inner span {
  1213. font-size: 24px;
  1214. }
  1215. .breadcrumb-box .inner a {
  1216. font-size: 24px;
  1217. height: 55px;
  1218. line-height: 55px;
  1219. }
  1220. .breadcrumb-box .phone_breadcrumb_text :deep(.el-breadcrumb__inner) {
  1221. font-size: 24px;
  1222. height: 55px;
  1223. line-height: 55px;
  1224. }
  1225. .newsDetail .inner .innerLeft .LeftTop>h1 {
  1226. font-size: 33px;
  1227. line-height: 44px;
  1228. }
  1229. .newsDetail .inner .innerLeft .LeftTop>p {
  1230. font-size: 14px;
  1231. line-height: 24px;
  1232. height: auto;
  1233. }
  1234. .newsDetail .inner .innerLeft .LeftTop>p span {
  1235. font-size: 14px;
  1236. line-height: 24px;
  1237. height: auto;
  1238. }
  1239. .newsDetail .inner .innerLeft .leftBottom {
  1240. font-size: 18px;
  1241. line-height: 22px;
  1242. }
  1243. .newsDetail .inner .innerLeft .recommendRead .recommendReadTitle {
  1244. height: auto;
  1245. overflow: hidden;
  1246. }
  1247. .newsDetail .inner .innerLeft .recommendRead .recommendReadTitle .read_title {
  1248. height: 44px;
  1249. line-height: 44px;
  1250. font-size: 28px;
  1251. }
  1252. .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle {
  1253. line-height: 44px;
  1254. height: 44px;
  1255. }
  1256. .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle a {
  1257. line-height: 44px;
  1258. height: 44px;
  1259. font-size: 24px;
  1260. }
  1261. .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle:nth-child(1)::after {
  1262. font-size: 14PX;
  1263. margin-top: 1PX;
  1264. }
  1265. .prevNext a {
  1266. height: 44px;
  1267. line-height: 44px;
  1268. font-size: 24px;
  1269. }
  1270. .prevNext {
  1271. margin-bottom: 44px;
  1272. }
  1273. .leftBottom,
  1274. .leftBottom * {
  1275. line-height: 44px;
  1276. font-size: 26px;
  1277. }
  1278. }
  1279. </style>